package com.example.zhunongzonghe.common;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
public class Result<T> implements Serializable {
    private boolean flag;   //是否成功
    private String msg;     //返回消息
    private Integer code;   //返回状态码
    private T data;         //返回数据


    //封装结果集1
    public Result(boolean flag, String msg, Integer code) {
        this.flag = flag;
        this.msg = msg;
        this.code = code;
    }

    public Result(boolean flag, String msg, Integer code, T data) {
        this.flag = flag;
        this.msg = msg;
        this.code = code;
        this.data = data;
    }
    public Result(T data){
        this.data=data;
    }

}
